package com.yan.swagger.controller;

import com.yan.swagger.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：Yan Guang
 * @date ：Created in 2020/11/19 20:31
 * @description：
 */
@RestController
public class HelloController {

    @GetMapping("hello")
    public String hello(){
        return "helloWorld~";
    }
    //只要我们接口中存在，就会被扫描的swagger中
    @PostMapping("user")
    public User user(){
        return new User();
    }

    //放在方法上
    @ApiOperation("hello2方法")
    @GetMapping("hello2")
    public String hello2(@ApiParam("用户名") String username){
        return "helloWorld"+username;

    }

}
